<template>
  <view class="tab-page">
    <view
      v-for="(item, index) in tabList"
      :key="index"
      class="tabbar-item"
      @click="switchTab(item.path)"
    >
      {{ item.text }}
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      params: null,
      currentPath: 2,
      authorId: uni.getStorageSync("userId"),
      tabList: [
        {
          text: "摇爪",
          path: "/pages/switchPages/index",
        },
        {
          text: "我的",
          path: "/pages/switchPages/mine",
        },
        {
          text: "笔记详情",
          path: "/pages/notes/detail/detail?noteId=13",
        },
        {
          text: "名片",
          path: "/pages/card/card",
        },
        {
          text: "关注/粉丝列表",
          path: "/pages/users/users?authorId=08325cbcaee44a8197d18af3e89b47fb",
        },
        {
          text: "关注/粉丝列表",
          path: "/pages/users/users1",
        },
        {
          text: "个人资料",
          path: "/pages/authorInfo/authorInfo",
        },
        {
          text: "收到的赞和收藏",
          path: "/pages/receiveUp/receiveUp",
        },
        {
          text: "新增关注",
          path: "/pages/newFollow/newFollow",
        },
        {
          text: "收到的评论和@",
          path: "/pages/replays/replays",
        },
        {
          text: "搜索",
          path: "/pages/search/search",
        },
        {
          text: "搜索好友",
          path: "/pages/searchForUsers/searchForUsers",
        },
        {
          text: "笔记列表",
          path: "/pages/noteList/noteList",
        },
        {
          text: "活动订单",
          path: "/pages/order/list",
        },
        {
          text: "视频笔记详情",
          path: "/pages/notes/videoDetail/videoDetail",
        },
        {
          text: "音乐笔记详情",
          path: "/pages/notes/musicDetail/musicDetail",
        },
        {
          text: "社区",
          path: "/pages/find/find",
        },
        {
          text: "关注",
          path: "/pages/find/follow",
        },
        {
          text: "详情",
          path: "/pages/find/detail",
        },
        {
          text: "我的",
          path: "/pages/my/my",
        },
        {
          text: "我的收藏",
          path: "/pages/myCollection/myCollection",
        },
        {
          text: "浏览记录",
          path: "/pages/historicalRecords/historicalRecords",
        },
        {
          text: "编辑宠物档案",
          path: "/pages/my/editPetProfile",
        },
        {
          text: "我的宠物病例",
          path: "/pages/my/editPetMedicalRecord?petId=1",
        },
        {
          text: "hotspot",
          path: "/pages/hotspot/hotspot",
        },
        {
          text: "hotspotOrder",
          path: "/pages/hotspot/hotspotOrder",
        },
        {
          text: "staff",
          path: "/pages/hotspot/staff",
        },
        {
          text: "活动订单二维码",
          path: "/pages/hotspot/orderDetail",
        },
        {
          text: "myOrder",
          path: "/pages/hotspot/myOrder",
        },
        {
          text: "operation",
          path: "/pages/operation/operation",
        },
        {
          text: "社区",
          path: "/pages/community/community",
        },
        {
          text: "社区二级",
          path: `/pages/community/communityList?id=1`,
        },
        {
          text: "社区文章详情",
          path: `/pages/community/communityDetail?noteId=1`,
        },
        {
          text: "shopList",
          path: "/pages/community/shopList/shopList",
        },
        {
          text: "subSection",
          path: "/pages/community/shopList/subSection",
        },
        {
          text: "search",
          path: "/pages/search/search",
        },
        {
          text: "result",
          path: "/pages/search/result",
        },
        {
          text: "set",
          path: "/pages/set",
        },
        {
          text: "mainText",
          path: "/pages/mainText/mainText",
        },
        {
          text: "rewardText",
          path: "/pages/mainText/rewardText",
        },
        {
          text: "我的钱包",
          path: "/pages/wallet/wallet",
        },
        {
          text: "钱包明细",
          path: "/pages/wallet/details",
        },
        {
          text: "急救",
          path: "/pages/emergency/emergency",
        },
        {
          text: "急救",
          path: "/pages/emergency/confirmOrder",
        },
      ],
    };
  },
  onLoad(options) {
    var url = window.location.href;
    // var url ='https://www.yaozhuasocial.com/yaozhua_shequ/#/pages/my/my?accessToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxIiwiZXhwIjoyMDY4NzIxNzA5LCJpbmZvIjoie1wibmlja05hbWVcIjpcIuaRh-eIquWumOaWuVwiLFwidGVybWluYWxcIjoxLFwidXNlcklkXCI6MSxcInVzZXJOYW1lXCI6XCLmkYfniKrlrpjmlrlcIn0ifQ.oX69C2NNqLb0DuMARt8yWjWGvoITRQ1ClOPoGyFcGRY&refreshToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxIiwiZXhwIjoyMDY4NzIxNzA5LCJpbmZvIjoie1wibmlja05hbWVcIjpcIuaRh-eIquWumOaWuVwiLFwidGVybWluYWxcIjoxLFwidXNlcklkXCI6MSxcInVzZXJOYW1lXCI6XCLmkYfniKrlrpjmlrlcIn0ifQ.8DQJZJtvCAhNEcGVI96cnDFdI-B_jiiZJnRffssgCLI&token=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3FIFjbzadVvhdunhVcWoeOnL7sjNt6dOFUMsEqAECzUj/qnIw3OhxiIv+Cq9jKxPikbEwAcin4FzENLfsPwYyMe24IwRI3gHtcbVqChG5bzedyA9AmYk+4s9d8qPow8Dh8HO1omQcfGP0Nu85JlDiAyF8KETDs1kYD1qwE/P/wwIDAQAB&token1=wvumjv5akmjn7rvwomottwjlcc49o3xf&token2=69b24b36ef2e5e4d&token3=b333388f15744753a9b77541735a3b52&userId=0f56366a8054fe012b04ed9b2e3d1201'
    var url1 = url.split("#/");
    var params = new URLSearchParams(new URL(url1).search);
    var token = params.get("accessToken");
    var userId = params.get("userId");

    uni.setStorageSync("token", token);
    uni.setStorageSync("parentId", 1);
    uni.setStorageSync("userId", userId);
    // uni.setStorageSync(
    // 	"token",
    // 	"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxMSIsImV4cCI6MjA2ODI5NDYxMiwiaW5mbyI6IntcIm5pY2tOYW1lXCI6XCJURVNUMDAxXCIsXCJ0ZXJtaW5hbFwiOjEsXCJ1c2VySWRcIjoxMSxcInVzZXJOYW1lXCI6XCJZWjE3NzA0ODIwNzcxXCJ9In0.nwD-xjwg7HMnuDPrjkvtVFPnyspO0_FEfmkoKOW_mOo&refreshToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxMSIsImV4cCI6MjA2ODI5NDYxMiwiaW5mbyI6IntcIm5pY2tOYW1lXCI6XCJURVNUMDAxXCIsXCJ0ZXJtaW5hbFwiOjEsXCJ1c2VySWRcIjoxMSxcInVzZXJOYW1lXCI6XCJZWjE3NzA0ODIwNzcxXCJ9In0.DqDCHroYdzIur6CfetJjg-CJfJj3tRlu9Hl-BX6O848&token=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUQp19p7ewqjM2R7/qORNlBlOaVWjOEl8AenPNOqPCUDchSidVDDR0C+aRsLNvail8XV6QCN+Dymz2HXVoetS4r3rNoFc0klUNTGVLk19LT6R9niIxj+drxsenpJLWD5aFU2gEsQbznu1OFM1BYfrnwdx9TA6eqpn2faXkZxjP4wIDAQAB&token1=i5qpmsp6bg4oagkg3pymyahfxsnr3c7g&token2=7d127e1bbd4839ef&token3=1238e70a6ba1404380712c932c3d0816&userId=08325cbcaee44a8197d18af3e89b47fb",
    // );
    // uni.setStorageSync("parentId", 1);
    // uni.setStorageSync("userId", "08325cbcaee44a8197d18af3e89b47fb");

    //  uni.setStorageSync("token", options.token);
    //  uni.setStorageSync("parentId", options.parentId);
    //  uni.setStorageSync("userId", options.userId);
  },
  onShow() {
    this.params = this.$route.params;
  },
  methods: {
    switchTab(path) {
      uni.navigateTo({
        url: path,
      });
    },
    getData() {
      uni.app.post("/blog/action/upReply", {}, "json", "", (res) => {
        console.log(res.data);
        if (res.data) {
          notes.isUp = true;
          notes.upCount++;
        } else {
          notes.isUp = false;
          notes.upCount--;
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.tab-page {
  .tabbar-item {
    height: 100%;
    font-size: 24rpx;
    color: #878787;
    width: 90vw;
    margin: 5px auto;
    height: 40px;
    background: #e8e8e8;
    display: flex;
    align-items: center;
    border-radius: 10px;
    padding: 0 20px;
    box-sizing: border-box;

    &.active {
      color: #000000;
      position: relative;

      &::after {
        content: "";
        position: absolute;
        bottom: 16rpx;
        left: 50%;
        transform: translateX(-50%);
        width: 56rpx;
        height: 6rpx;
        background: #7414ff;
        border-radius: 3rpx;
      }
    }
  }

  .swiper {
    height: calc(100vh - 88rpx);
  }
}
</style>
